/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import lombok.Builder;
import lombok.experimental.Tolerate;

import javax.persistence.*;

/**
 * ClassName: PurchaseSpec <br/>
 * Function: 采购规格 <br/>
 * date: 2018-11-07 11:55:43 <br/>
 *
 * @author liuwenjin
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="purchase_specs")
public class PurchaseSpec extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	// 物料id  cascade = CascadeType.PERSIST
	@ManyToOne
	@JoinColumn(name="material_id")
	private Material material = null;

	// 规格名称 
    @Column(name="name", length = 300)
	private String name = null;

	// 采购单位 
    @Column(name="unit", length = 300)
	private String unit = null;

	// 兑换比例 
    @Column(name="ratio",scale=2)
	private Double ratio = null;

	// 采购单价 
    @Column(name="price",scale=2)
	private Double price = null;

	// 历史进价
	@Column(name="history_price",scale=2)
	private Double historyPrice = null;

	@Column(name = "has_def")
	private Boolean hasDef = false;

    @Tolerate
	public PurchaseSpec() {
		
	}
    @Tolerate
	public PurchaseSpec(Long id){
    	super.setId(id);
    }


	/**
	 * 获取规格名称
	 */
	public String getName() {
		return this.name;
	}

    /**
     * 设置规格名称
     */
	public PurchaseSpec setName(String name) {
		this.name = name;
		return this;
	}

	/**
	 * 获取采购单位
	 */
	public String getUnit() {
		return this.unit;
	}

    /**
     * 设置采购单位
     */
	public PurchaseSpec setUnit(String unit) {
		this.unit = unit;
		return this;
	}


	public Double getRatio() {
		return ratio;
	}

	public void setRatio(Double ratio) {
		this.ratio = ratio;
	}

	/**
	 * 获取采购单价
	 */
	public Double getPrice() {
		return this.price;
	}

    /**
     * 设置采购单价
     */
	public PurchaseSpec setPrice(Double price) {
		this.price = price;
		return this;
	}

	public Material getMaterial() {
		return material;
	}

	public void setMaterial(Material material) {
		this.material = material;
	}

	public Double getHistoryPrice() {
		return historyPrice;
	}

	public void setHistoryPrice(Double historyPrice) {
		this.historyPrice = historyPrice;
	}

	public Boolean getHasDef() {
		return hasDef;
	}

	public void setHasDef(Boolean hasDef) {
		this.hasDef = hasDef;
	}
}
